/**
* @author Ashish Gupta
* CVSSP, University of Surrey
* Copyright (c) 2010 Ashish Gupta
* All rights reserved.
*/
/**
 * 
 */
package uk.surrey.ash.ga;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author Ashish
 *
 */
public class CellSpace {
	private ArrayList<Cell> cells = new ArrayList<Cell>();

	/**
	 * @return the cells
	 */
	public ArrayList<Cell> getCells() {
		return cells;
	}

	/**
	 * @param carvoc06
	 * @param hashcodes
	 */
	public void setCells(Dataset dataset, HashCode hashcodes) {
//		read into imgidx, hashcode, and initialize gene
		Iterator<Integer> hashcodeItr = hashcodes.getHashcode().iterator();
		while(hashcodeItr.hasNext()){
			Cell cell = new Cell();
			int tmpHashCode = hashcodeItr.next();
			cell.setHashCode(tmpHashCode);
//			int imgID = dataset.getImages().get(tmpHashCode).getImgid();
//			int imgClass = dataset.getImages().get(tmpHashCode).getImgclass();
			cell.setImageIdx(dataset.getImages().get(tmpHashCode).getImgid());
			cell.setImageClass(dataset.getImages().get(tmpHashCode).getImgclass());
			cells.add(cell);
		}
	}

}
